# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.
#
# from AUR - adapted to you style
#
# Old Contributor: Lex Black <autumn-wind@web.de>

pkgname=greenbone-feed-sync
pkgver=25.1.0
pkgrel=1
pkgdesc='New script for downloading the Greenbone Community Feed.'
arch=('any')
url='https://github.com/greenbone/greenbone-feed-sync'
license=('GPL-3.0-only')
depends=('rsync' 'python-rich' 'python-tomli' 'python-shtab')
makedepends=('python-build' 'python-installer' 'python-wheel' 'python-poetry')
source=("https://github.com/greenbone/greenbone-feed-sync/archive/v$pkgver.tar.gz"
        'greenbone-certdata-sync.service'
        'greenbone-certdata-sync.timer'
        'greenbone-feed-sync.service'
        'greenbone-feed-sync.timer'
        'greenbone-nvt-sync.service'
        'greenbone-nvt-sync.timer'
        'greenbone-scapdata-sync.service'
        'greenbone-scapdata-sync.timer')
sha512sums=('970aa6b0b75fabc45629dca3f036a3fca925fa03e52f704033a1d4497e77afaedcbfe9afea94400ab1b136bb19d8829cdab45d6c3c9de6088e9a48da0871128f'
            '0e61d540bbe7d4a88d080e0b213f6c472d9b1b5bf122780dec9e2644fe15bae9a9938432fdcfde73ed9d280dd319dd4796acb83ea8135aab3fe981a00b612504'
            '4d259ff625d29b10040ab1ff7cb472b3dee2355c8ef01275754c5c08779e0de3d5ae1cbb157239fd17d663644b43a642fe15c2d8e13cde037e52ad6a4e2e0afd'
            'de1cc454f5bdf402368ca06680b542b3c10edd6e0e126be955fd3af140c0bb722b1664a9b3ac72bf10fae54c85142bf58f5becde767a27e102c19abe78216b0a'
            'e1be40755530f9793c91c47db3bc1fb65266dcea2d1ba5e3ba1de97a93572bc52a18dc182f9c4d11fc4586f714663447917d70321e32c20bbe35765f999141d2'
            '1ef913c24721533b0f779047532de63d195e8498885b90972a7bbbfb734444c0f7cbdcc52c437b2ce773881d45eadfcec03fcd00886e02962cb06d318d0c7c96'
            '2df63297cd9bd1cfb7b774152b1791ff946a1a410e563e54212652d847063b3c22b5362cd287b1bd73684be1fbd66464a2f8bb79b92cd086ba58e9a801d675ec'
            'd90a42e8f2f77b05432f61ead247e8d4144569ae622159a45f0541469daa4447fa667ef6af42fa0117c957ab2a9afee425fef7bdc3532c8f89021e074c590052'
            '224bb41d298083755a77151038403b678bc66b9184b9b960ce4a380f8774ec7794e2f967eb48efd158a9ac7006b4a46a1f84267b50eef3e85ced5193a278a451')

build() {
  cd "$pkgname-$pkgver"

  python -m build --wheel --no-isolation
}

package() {
  cd "$pkgname-$pkgver"

  python -m installer --destdir="$pkgdir" dist/*.whl

  install -Dm 644 "$srcdir/greenbone-certdata-sync.service" \
    -t "$pkgdir/usr/lib/systemd/system"
  install -Dm 644 "$srcdir/greenbone-certdata-sync.timer" \
    -t "$pkgdir/usr/lib/systemd/system"
  install -Dm 644 "$srcdir/greenbone-feed-sync.service" \
    -t "$pkgdir/usr/lib/systemd/system"
  install -Dm 644 "$srcdir/greenbone-feed-sync.timer" \
    -t "$pkgdir/usr/lib/systemd/system"
  install -Dm 644 "$srcdir/greenbone-nvt-sync.service" \
    -t "$pkgdir/usr/lib/systemd/system"
  install -Dm 644 "$srcdir/greenbone-nvt-sync.timer" \
    -t "$pkgdir/usr/lib/systemd/system"
  install -Dm 644 "$srcdir/greenbone-scapdata-sync.service" \
    -t "$pkgdir/usr/lib/systemd/system"
  install -Dm 644 "$srcdir/greenbone-scapdata-sync.timer" \
  -t "$pkgdir/usr/lib/systemd/system"
}

